counting occurences

Hi,

I try to count how many objects a same user has modified since the last baseline in order to have the 3 first users that have modified the module. 

For example, I have 60 objects,

user A has modified 10 objects,

B has modified 5 objects,

C has modified 5 objects,

D has modified 25 objects,

E has modified 15 objects.

I want to retrieve D, E and A.

 

Can someone help me ? I don't know how to begin (with arrays, skip lists, or just strings ???) 


Estebell - Mon May 12 10:07:45 EDT 2014

Re: counting occurences
llandale - Mon May 12 14:04:14 EDT 2014

First off, here is a useful function for counting things:

//*********************
bool fSkip_Increment(Skip upd_skpList, string KeyValue)
{ // Insert the KeyValue into the Skip list's 'Key'.
 // The 'Data' portion of the Skip is set to 1 for new inserts and is
 //    incremented for already existing 'Key's in the Skip.
 // 'Data' MUST be of type Integer.
 //   (represents the number of references).
 // Return whether this is a first insert for KeyValue into the Skip.

 bool IsNewValue = false

 int NumReferences = 0 // Remains zero if next "find" doesn't find anything:
 if(find(upd_skpList, KeyValue, NumReferences))
      delete(upd_skpList, KeyValue)  // Remove It
 else IsNewValue = true   // Mark it New
   // ReInsert new or updated counts
 NumReferences++
 put (upd_skpList, KeyValue, NumReferences)
 return(IsNewValue)
} // end fSkip_Increment()

If you mean counting who LAST modified an object.  But if you did you could just query the object's "Last Modified By" attribute.

Skip skpCount = createString()  // KEY 'string' user name; DATA 'int' Count
for o in entire mod do
{  Name = o."Last Modified By"
   fSkip_Increment(skpCount, Name)
}
for Count in skpCount do
{  Name = (string key skpCount)
   print Count "\t" Name "\n"
}

Given that information you could figure out how to show just the top 3.

-Louie